home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Interfaces / CIncludes / OCEMessaging.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-10  |  26.2 KB  |  1,066 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Friday, June 4, 1993 at 10:05AM
  4.  OCEMessaging.h
  5.  C Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1990-1993
  8.   All rights reserved
  9.  
  10. ************************************************************/
  11.  
  12.  
  13. #ifndef __OCEMESSAGING__
  14. #define __OCEMESSAGING__
  15.  
  16. #ifndef __DIGITALSIGNATURE__
  17. #include <DigitalSignature.h>
  18. #endif
  19.  
  20. #ifndef __FILES__
  21. #include <Files.h>
  22. #endif
  23.  
  24. #ifndef    __OCE__
  25. #include <OCE.h>
  26. #endif
  27.  
  28. #ifndef __OCEAUTHDIR__
  29. #include <OCEAuthDir.h>
  30. #endif
  31.  
  32. #ifndef __TYPES__
  33. #include <Types.h>
  34. #endif
  35.  
  36.  
  37.  
  38. /******************************************************************************/
  39. /* Definitions common to OCEMessaging and to OCEMail. These relate to addressing,
  40. message ids and priorities, etc. */
  41.  
  42.  
  43. /* Values of IPMPriority */
  44. enum {
  45.     kIPMAnyPriority = 0,        /* FOR FILTER ONLY */
  46.     kIPMNormalPriority = 1,
  47.     kIPMLowPriority,
  48.     kIPMHighPriority
  49. };
  50.  
  51. typedef Byte IPMPriority;
  52.  
  53.  
  54. /* Values of IPMAccessMode */
  55. enum {
  56.     kIPMAtMark,
  57.     kIPMFromStart,
  58.     kIPMFromLEOM,
  59.     kIPMFromMark
  60. };
  61.  
  62. typedef unsigned short IPMAccessMode;
  63.  
  64.  
  65. enum {
  66.     kIPMUpdateMsgBit = 4,
  67.     kIPMNewMsgBit = 5,
  68.     kIPMDeleteMsgBit = 6
  69. };
  70.  
  71. /* Values of IPMNotificationType */
  72. enum {
  73.     kIPMUpdateMsgMask    = 1<<kIPMUpdateMsgBit,
  74.     kIPMNewMsgMask        = 1<<kIPMNewMsgBit,
  75.     kIPMDeleteMsgMask    = 1<<kIPMDeleteMsgBit
  76. };
  77.  
  78. typedef Byte IPMNotificationType;
  79.  
  80.  
  81. /* Values of IPMSenderTag */
  82. enum {
  83.     kIPMSenderRStringTag,
  84.     kIPMSenderRecordIDTag
  85. };
  86.  
  87. typedef unsigned short IPMSenderTag;
  88.  
  89.  
  90. enum {
  91.     kIPMFromDistListBit = 0,
  92.     kIPMDummyRecBit = 1,
  93.     kIPMFeedbackRecBit = 2,    /* should be redirected to feedback queue */
  94.     kIPMReporterRecBit = 3,    /* should be redirected to reporter original queue */
  95.     kIPMBCCRecBit = 4    /* this recipient is blind to all recipients of message */
  96. };
  97.  
  98. /* Values of OCERecipientOffsetFlags */
  99. enum {
  100.     kIPMFromDistListMask            = 1<<kIPMFromDistListBit,
  101.     kIPMDummyRecMask                = 1<<kIPMDummyRecBit,
  102.     kIPMFeedbackRecMask                = 1<<kIPMFeedbackRecBit,
  103.     kIPMReporterRecMask                = 1<<kIPMReporterRecBit,
  104.     kIPMBCCRecMask                    = 1<<kIPMBCCRecBit
  105. };
  106.  
  107. typedef Byte OCERecipientOffsetFlags;
  108.  
  109.  
  110. struct OCECreatorType {
  111.     OSType    msgCreator;
  112.     OSType    msgType;
  113. };
  114.  
  115. typedef struct OCECreatorType OCECreatorType;
  116.  
  117.  
  118.  
  119. #define kIPMTypeWildCard        'ipmw'
  120.  
  121. #define kIPMFamilyUnspecified    0
  122. #define kIPMFamilyWildCard        0x3F3F3F3FL
  123.                                 /* '????' */
  124.  
  125. /* well known signature */
  126. #define kIPMSignature            'ipms'    /* base type */
  127.  
  128. /* well known message types */
  129. #define kIPMReportNotify        'rptn'    /* routing feedback */
  130.  
  131. /* well known message block types */
  132. #define kIPMEnclosedMsgType        'emsg'    /* enclosed (nested) message */
  133. #define kIPMReportInfo            'rpti'    /* recipient information */
  134. #define kIPMDigitalSignature     'dsig'    /* digital signature */
  135.  
  136. /* Values of IPMMsgFormat */
  137. enum {
  138.     kIPMOSFormatType = 1,
  139.     kIPMStringFormatType = 2
  140. };
  141.  
  142. typedef unsigned short IPMMsgFormat;
  143.  
  144. typedef Str32 IPMStringMsgType;
  145.  
  146. struct IPMMsgType {
  147.     IPMMsgFormat            format;        /* IPMMsgFormat*/
  148.     union{
  149.         OCECreatorType        msgOSType;
  150.         IPMStringMsgType    msgStrType;
  151.     }theType;
  152. };
  153.  
  154. typedef struct IPMMsgType IPMMsgType;
  155.  
  156.  
  157. /*
  158. Following are the known extension values for IPM addresses handled by Apple.
  159. We define the definition of the entn extension below.
  160. */
  161.  
  162. enum {
  163.     kOCEalanXtn            = 'alan',
  164.     kOCEentnXtn            = 'entn',        /* entn = entity name (aka DSSpec) */
  165.     kOCEaphnXtn            = 'aphn'
  166. };
  167.  
  168. /*
  169. Following are the specific definitions for the extension for the standard
  170. OCEMail 'entn' addresses.  [Note, the actual extension is formatted as in
  171. IPMEntityNameExtension.]
  172. */
  173.  
  174. /* entn extension forms */
  175. enum {
  176.     kOCEAddrXtn            = 'addr',
  177.     kOCEQnamXtn            = 'qnam',
  178.     kOCEAttrXtn            = 'attr',        /* an attribute specification */
  179.     kOCESpAtXtn            = 'spat'        /* specific attribute */
  180. };
  181.  
  182. /*
  183. Following are the specific definitions for standard
  184. OCEMail 'aphn' extension value.  
  185.  
  186. All RStrings here are packed (e.g. truncated to length) and even padded (e.g.
  187. if length odd, then a pad byte (zero) should be introduced before the next field).
  188.  
  189. The extension value is in the packed form of the following structure:
  190.     RString        phoneNumber;
  191.     RString        modemType;
  192.     Str32        queueuName;
  193.  
  194. The body of phoneNumber compound RString is in the packed form of the following structure:
  195.     short         subType;
  196.     RString     countryCode;                // used when subType == kOCEUseHandyDial
  197.     RString        areaCode;                    // used when subType == kOCEUseHandyDial
  198.     RString        phone;                        // used when subType == kOCEUseHandyDial
  199.     RString        postFix;                    // used when subType == kOCEUseHandyDial
  200.     RString        nonHandyDialString;            // used when subType == kOCEDontUseHandyDial
  201. */
  202.  
  203. /* phoneNumber sub type constants */
  204. enum {
  205.     kOCEUseHandyDial        = 1,
  206.     kOCEDontUseHandyDial    = 2
  207. };
  208.  
  209. /* FORMAT OF A PACKED FORM RECIPIENT */
  210. #define OCEPackedRecipientHeader    \
  211.     unsigned short        dataLength;
  212.  
  213. struct ProtoOCEPackedRecipient {
  214.     OCEPackedRecipientHeader
  215. };
  216. typedef struct ProtoOCEPackedRecipient ProtoOCEPackedRecipient;
  217.  
  218. #define kOCEPackedRecipientMaxBytes    (4096 - sizeof(ProtoOCEPackedRecipient))
  219. struct OCEPackedRecipient {
  220.     OCEPackedRecipientHeader
  221.     Byte            data[kOCEPackedRecipientMaxBytes];
  222. };
  223. typedef struct OCEPackedRecipient OCEPackedRecipient;
  224.  
  225.  
  226. struct IPMEntnQueueExtension {
  227.     Str32 queueName;
  228. };
  229.  
  230. typedef struct IPMEntnQueueExtension IPMEntnQueueExtension;
  231.  
  232. struct IPMEntnAttributeExtension {                /* kOCEAttrXtn */
  233.     AttributeType attributeName;
  234. };
  235.  
  236. typedef struct IPMEntnAttributeExtension IPMEntnAttributeExtension;
  237.  
  238. struct IPMEntnSpecificAttributeExtension {        /* kOCESpAtXtn */
  239.     AttributeCreationID attributeCreationID;
  240.     AttributeType attributeName;
  241. };
  242.  
  243. typedef struct IPMEntnSpecificAttributeExtension IPMEntnSpecificAttributeExtension;
  244.  
  245. /* All IPM entn extensions fit within the following */
  246.  
  247. struct IPMEntityNameExtension {
  248.     OSType subExtensionType;
  249.     union {
  250.         IPMEntnSpecificAttributeExtension specificAttribute;
  251.         IPMEntnAttributeExtension        attribute;
  252.         IPMEntnQueueExtension            queue;
  253.     } u;
  254. };
  255.  
  256. typedef struct IPMEntityNameExtension IPMEntityNameExtension;
  257.  
  258. /* addresses with kIPMNBPXtn should specify this nbp type */
  259. #define kIPMWSReceiverNBPType "\pMsgReceiver"
  260.  
  261.  
  262.  
  263.  
  264. struct IPMMsgID {
  265.     unsigned long id[4];
  266.     };
  267.     
  268. typedef struct IPMMsgID IPMMsgID;
  269.  
  270.  
  271. /* Values of IPMHeaderSelector */
  272. enum {
  273.     kIPMTOC = 0,
  274.     kIPMSender = 1,
  275.     kIPMProcessHint = 2,
  276.     kIPMMessageTitle = 3,
  277.     kIPMMessageType = 4,
  278.     kIPMFixedInfo = 7
  279. };
  280.  
  281. typedef Byte IPMHeaderSelector;
  282.  
  283. struct IPMSender {
  284.     IPMSenderTag        sendTag;
  285.     union{
  286.         RString            rString;
  287.         PackedRecordID    rid;
  288.     }theSender;
  289. };
  290. typedef struct IPMSender IPMSender;
  291.  
  292. typedef DSSpec OCERecipient;
  293.  
  294.  
  295.  
  296.  
  297.  
  298. /******************************************************************************/
  299. /* Definitions specific to OCEMessaging */
  300.  
  301. typedef unsigned long    IPMContextRef;
  302. typedef unsigned long    IPMQueueRef;
  303. typedef unsigned long    IPMMsgRef;
  304. typedef unsigned long    IPMSeqNum;
  305. typedef Str32 IPMProcHint;
  306. typedef Str32 IPMQueueName;
  307.  
  308.  
  309. typedef pascal void    (*IPMNoteProcPtr)(
  310.     IPMQueueRef queue, IPMSeqNum seqNum, IPMNotificationType notificationType,
  311.     unsigned long userData);
  312.  
  313.  
  314. struct IPMFixedHdrInfo {
  315.     unsigned short        version;
  316.     Boolean                authenticated;
  317.     Boolean                signatureEnclosed;        /*  digital signature enclosed */
  318.     unsigned long        msgSize;
  319.     IPMNotificationType    notification;
  320.     IPMPriority            priority;
  321.     unsigned short        blockCount;
  322.     unsigned short        originalRcptCount;        /*        original number of recipients */
  323.     unsigned long        refCon;                    /*        Client defined data */
  324.     unsigned short        reserved;
  325.     UTCTime                creationTime;            /*        Time when it was created */
  326.     IPMMsgID            msgID;
  327.     OSType                family;                    /* family this msg belongs (e.g. mail) */
  328. };
  329.  
  330. typedef struct IPMFixedHdrInfo IPMFixedHdrInfo;
  331.  
  332. enum {
  333.     kIPMDeliveryNotificationBit        = 0,
  334.     kIPMNonDeliveryNotificationBit    = 1,
  335.     kIPMEncloseOriginalBit            = 2,
  336.     kIPMSummaryReportBit            = 3,
  337.     kIPMOriginalOnlyOnErrorBit        = 4        /* modify enclose original to only on error */
  338. };
  339.  
  340. enum {
  341.     kIPMNoNotificationMask            = 0x00,
  342.     kIPMDeliveryNotificationMask    = 1<<kIPMDeliveryNotificationBit,
  343.     kIPMNonDeliveryNotificationMask    = 1<<kIPMNonDeliveryNotificationBit,
  344.     kIPMDontEncloseOriginalMask        = 0x00,
  345.     kIPMEncloseOriginalMask            = 1<<kIPMEncloseOriginalBit,
  346.     kIPMImmediateReportMask            = 0x00,
  347.     kIPMSummaryReportMask            = 1<<kIPMSummaryReportBit,
  348.     kIPMOriginalOnlyOnErrorMask        = 1<<kIPMOriginalOnlyOnErrorBit,
  349.     kIPMEncloseOriginalOnErrorMask    = (kIPMOriginalOnlyOnErrorMask|kIPMEncloseOriginalMask)
  350. };
  351.  
  352. /* standard Non delivery codes */
  353. enum {
  354.     kIPMNoSuchRecipient                    =    0x0001,
  355.     kIPMRecipientMalformed                =    0x0002,
  356.     kIPMRecipientAmbiguous                =    0x0003,
  357.     kIPMRecipientAccessDenied            =    0x0004,
  358.     kIPMGroupExpansionProblem            =    0x0005,
  359.     kIPMMsgUnreadable                    =    0x0006,
  360.     kIPMMsgExpired                        =    0x0007,
  361.     kIPMMsgNoTranslatableContent        =    0x0008,
  362.     kIPMRecipientReqStdCont                =    0x0009,
  363.     kIPMRecipientReqSnapShot            =    0x000A,
  364.     kIPMNoTransferDiskFull                =    0x000B,
  365.     kIPMNoTransferMsgRejectedbyDest        =    0x000C,
  366.     kIPMNoTransferMsgTooLarge            =    0x000D
  367. };
  368.  
  369. /*************************************************************************/
  370. /*
  371. This is the structure that will be returned by enumerate and getmsginfo
  372. This definition is just to give you a template, the position of msgType
  373. is variable since this is a packed structure.  procHint and msgType are
  374. packed and even length padded.
  375. */
  376. struct IPMMsgInfo {                        /* master message info */
  377.     IPMSeqNum            sequenceNum;
  378.  
  379.     unsigned long        userData;
  380.     unsigned short        respIndex;
  381.     Byte                padByte;
  382.     IPMPriority            priority;
  383.     unsigned long        msgSize;
  384.     unsigned short        originalRcptCount;
  385.     unsigned short        reserved;
  386.     UTCTime                creationTime;
  387.     IPMMsgID            msgID;
  388.     OSType                family;                    /* family this msg belongs (e.g. mail) */
  389.     IPMProcHint            procHint;
  390.     IPMMsgType            msgType;
  391. };
  392.  
  393. typedef struct IPMMsgInfo IPMMsgInfo;
  394.  
  395. typedef OCECreatorType IPMBlockType;
  396.  
  397. struct IPMTOC {
  398.     IPMBlockType        blockType;
  399.     long                blockOffset;
  400.     unsigned long        blockSize;
  401.     unsigned long        blockRefCon;
  402. };
  403.  
  404. typedef struct IPMTOC IPMTOC;
  405.  
  406.  
  407. /*
  408. The following structure is just to describe the layout of the SingleFilter.
  409. Each field should be packed and word aligned when passed to the IPM ToolBox.
  410. */
  411.  
  412. struct IPMSingleFilter {
  413.     IPMPriority            priority;
  414.     Byte                padByte;
  415.     OSType                family;            /* family this msg belongs (e.g. mail), '????' for all */
  416.     ScriptCode            script;            /* Language Identifier */
  417.     IPMProcHint            hint;
  418.     IPMMsgType            msgType;
  419. };
  420.  
  421. typedef struct IPMSingleFilter IPMSingleFilter;
  422.  
  423. struct IPMFilter {
  424.     unsigned short        count;
  425.     IPMSingleFilter        sFilters[1];
  426. };
  427.  
  428. typedef struct IPMFilter IPMFilter;
  429.  
  430. /*************************************************************************/
  431. /*
  432. Following structures define the “start” of a recipient report block and the
  433. elements of the array respectively.
  434. */
  435.  
  436. struct IPMReportBlockHeader {
  437.     IPMMsgID            msgID;            /* message id of the original */
  438.     UTCTime                creationTime;    /* creation time of the report */
  439. };
  440.  
  441. typedef struct IPMReportBlockHeader IPMReportBlockHeader;
  442.  
  443. struct OCERecipientReport {
  444.     unsigned short        rcptIndex;        /* index of recipient in original message */
  445.     OSErr                result;            /* result of sending letter to this recipient*/
  446. };
  447.  
  448. typedef struct OCERecipientReport OCERecipientReport;
  449. /*************************************************************************/
  450.  
  451.  
  452. #define IPMParamHeader            \
  453.     Ptr        qLink;                \
  454.     long    reservedH1;            \
  455.     long    reservedH2;            \
  456.     ProcPtr    ioCompletion;        \
  457.     OSErr    ioResult;            \
  458.     long    saveA5;                \
  459.     short    reqCode;
  460.  
  461.  
  462. struct IPMOpenContextPB {
  463.     IPMParamHeader
  464.     IPMContextRef        contextRef;        /* <--  Context reference to be used in further calls*/
  465. };
  466.  
  467. typedef struct IPMOpenContextPB IPMOpenContextPB;
  468. typedef IPMOpenContextPB    IPMCloseContextPB;
  469.  
  470.  
  471. struct IPMCreateQueuePB {
  472.     IPMParamHeader
  473.     long                filler1;
  474.     OCERecipient*        queue;
  475.     AuthIdentity        identity;        /* used only if queue is remote */
  476.     PackedRecordID*        owner;            /* used only if queue is remote */
  477. };
  478.  
  479. typedef struct IPMCreateQueuePB IPMCreateQueuePB;
  480. /* For createqueue and deletequeue only queue and identity are used */
  481. typedef IPMCreateQueuePB    IPMDeleteQueuePB;
  482.  
  483.  
  484. struct IPMOpenQueuePB {
  485.     IPMParamHeader
  486.     IPMContextRef        contextRef;
  487.     OCERecipient*        queue;
  488.     AuthIdentity        identity;
  489.     IPMFilter*            filter;
  490.     IPMQueueRef            newQueueRef;
  491.     IPMNoteProcPtr        notificationProc;
  492.     unsigned long        userData;
  493.     IPMNotificationType    noteType;
  494.     Byte                padByte;
  495.     long                reserved;
  496.     long                reserved2;
  497. };
  498.  
  499. typedef struct IPMOpenQueuePB IPMOpenQueuePB;
  500.  
  501. struct IPMCloseQueuePB {
  502.     IPMParamHeader
  503.     IPMQueueRef            queueRef;
  504. };
  505.  
  506. typedef struct IPMCloseQueuePB IPMCloseQueuePB;
  507.  
  508. struct IPMEnumerateQueuePB {
  509.     IPMParamHeader
  510.     IPMQueueRef            queueRef;
  511.     IPMSeqNum            startSeqNum;
  512.     Boolean                getProcHint;
  513.     Boolean                getMsgType;
  514.     short                filler;
  515.     IPMFilter*            filter;
  516.     unsigned short        numToGet;
  517.     unsigned short        numGotten;
  518.     unsigned long        enumCount;
  519.     Ptr                    enumBuffer;        /* will be packed array of IPMMsgInfo */
  520.     unsigned long        actEnumCount;
  521. };
  522.  
  523. typedef struct IPMEnumerateQueuePB IPMEnumerateQueuePB;
  524. typedef IPMEnumerateQueuePB    IPMChangeQueueFilterPB;
  525.  
  526.  
  527. struct IPMDeleteMsgRangePB {
  528.     IPMParamHeader
  529.     IPMQueueRef            queueRef;
  530.     IPMSeqNum            startSeqNum;
  531.     IPMSeqNum            endSeqNum;
  532.     IPMSeqNum            lastSeqNum;
  533. };
  534.  
  535. typedef struct IPMDeleteMsgRangePB IPMDeleteMsgRangePB;
  536.  
  537.  
  538. struct IPMOpenMsgPB {
  539.     IPMParamHeader
  540.     IPMQueueRef            queueRef;
  541.     IPMSeqNum            sequenceNum;
  542.     IPMMsgRef            newMsgRef;
  543.     IPMSeqNum            actualSeqNum;
  544.     Boolean                exactMatch;
  545.     Byte                padByte;
  546.     long                reserved;
  547. };
  548.  
  549. typedef struct IPMOpenMsgPB IPMOpenMsgPB;
  550.  
  551.  
  552. struct IPMOpenHFSMsgPB {
  553.     IPMParamHeader
  554.     FSSpec*                hfsPath;
  555.     long                filler;
  556.     IPMMsgRef            newMsgRef;
  557.     long                filler2;
  558.     Byte                filler3;
  559.     long                reserved;
  560. };
  561.  
  562. typedef struct IPMOpenHFSMsgPB IPMOpenHFSMsgPB;
  563.  
  564.  
  565. struct IPMOpenBlockAsMsgPB {
  566.     IPMParamHeader
  567.     IPMMsgRef            msgRef;
  568.     unsigned long        filler;
  569.     IPMMsgRef            newMsgRef;
  570.     unsigned short        filler2[7];
  571.     unsigned short        blockIndex;
  572. };
  573.  
  574. typedef struct IPMOpenBlockAsMsgPB IPMOpenBlockAsMsgPB;
  575.  
  576.  
  577. struct IPMCloseMsgPB {
  578.     IPMParamHeader
  579.     IPMMsgRef            msgRef;
  580.     Boolean                deleteMsg;
  581. };
  582.  
  583. typedef struct IPMCloseMsgPB IPMCloseMsgPB;
  584.  
  585.  
  586. struct IPMGetMsgInfoPB {
  587.     IPMParamHeader
  588.     IPMMsgRef            msgRef;
  589.     IPMMsgInfo*            info;
  590. };
  591.  
  592. typedef struct IPMGetMsgInfoPB IPMGetMsgInfoPB;
  593.  
  594.  
  595. struct IPMReadHeaderPB {
  596.     IPMParamHeader
  597.     IPMMsgRef            msgRef;
  598.     unsigned short        fieldSelector;
  599.     long                offset;
  600.     unsigned long        count;
  601.     Ptr                    buffer;
  602.     unsigned long        actualCount;
  603.     unsigned short        filler;
  604.     unsigned long        remaining;
  605. };
  606.  
  607. typedef struct IPMReadHeaderPB IPMReadHeaderPB;
  608.  
  609.  
  610. struct IPMReadRecipientPB {
  611.     IPMParamHeader
  612.     IPMMsgRef            msgRef;
  613.     unsigned short        rcptIndex;
  614.     long                offset;
  615.     unsigned long        count;
  616.     Ptr                    buffer;
  617.     unsigned long        actualCount;
  618.     short                reserved;            /* must be zero */
  619.     unsigned long        remaining;
  620.     unsigned short        originalIndex;
  621.     OCERecipientOffsetFlags        recipientOffsetFlags;
  622. };
  623.  
  624. typedef struct IPMReadRecipientPB IPMReadRecipientPB;
  625.  
  626.  
  627. /*
  628. replyQueue works like recipient. [can no longer read it via ReadHeader]
  629. OriginalIndex is meaningless, rcptFlags are used seperately and there are
  630. currently none defined.
  631. */
  632. typedef IPMReadRecipientPB IPMReadReplyQueuePB;
  633.  
  634.  
  635. struct IPMGetBlkIndexPB {
  636.     IPMParamHeader
  637.     IPMMsgRef            msgRef;
  638.     IPMBlockType        blockType;
  639.     unsigned short        index;
  640.     unsigned short        startingFrom;
  641.     IPMBlockType        actualBlockType;
  642.     unsigned short        actualBlockIndex;
  643. };
  644.  
  645. typedef struct IPMGetBlkIndexPB IPMGetBlkIndexPB;
  646.  
  647.  
  648. struct IPMReadMsgPB {
  649.     IPMParamHeader
  650.     IPMMsgRef            msgRef;
  651.     IPMAccessMode        mode;
  652.     long                offset;
  653.     unsigned long        count;
  654.     Ptr                    buffer;
  655.     unsigned long        actualCount;
  656.     unsigned short        blockIndex;
  657.     unsigned long        remaining;
  658. };
  659.  
  660. typedef struct IPMReadMsgPB IPMReadMsgPB;
  661.  
  662. struct IPMVerifySignaturePB {
  663.     IPMParamHeader
  664.     IPMMsgRef            msgRef;
  665.     SIGContextPtr        signatureContext;
  666. };
  667.  
  668. typedef struct IPMVerifySignaturePB IPMVerifySignaturePB;
  669.  
  670. struct IPMNewMsgPB {
  671.     IPMParamHeader
  672.     unsigned long            filler;
  673.     OCERecipient*            recipient;
  674.     OCERecipient*            replyQueue;
  675.     StringPtr                procHint;
  676.     unsigned short            filler2;
  677.     IPMMsgType*                msgType;
  678.     unsigned long            refCon;
  679.     IPMMsgRef                newMsgRef;
  680.     unsigned short            filler3;
  681.     long                    filler4;
  682.     AuthIdentity            identity;
  683.     IPMSender*                sender;
  684.     unsigned long            internalUse;
  685.     unsigned long            internalUse2;
  686. };
  687.  
  688. typedef struct IPMNewMsgPB IPMNewMsgPB;
  689.  
  690. struct IPMNewHFSMsgPB {
  691.     IPMParamHeader
  692.     FSSpec*                hfsPath;
  693.     OCERecipient*        recipient;
  694.     OCERecipient*        replyQueue;
  695.     StringPtr            procHint;
  696.     unsigned short        filler2;
  697.     IPMMsgType*            msgType;
  698.     unsigned long        refCon;
  699.     IPMMsgRef            newMsgRef;
  700.     unsigned short        filler3;
  701.     long                filler4;
  702.     AuthIdentity        identity;
  703.     IPMSender*            sender;
  704.     unsigned long        internalUse;
  705.     unsigned long        internalUse2;
  706. };
  707.  
  708. typedef struct IPMNewHFSMsgPB IPMNewHFSMsgPB;
  709.  
  710. struct IPMNestMsgPB {
  711.     IPMParamHeader
  712.     IPMMsgRef            msgRef;
  713.     unsigned short        filler[9];
  714.     unsigned long        refCon;
  715.     IPMMsgRef            msgToNest;
  716.     unsigned short        filler2;
  717.     long                startingOffset;
  718. };
  719.  
  720. typedef struct IPMNestMsgPB IPMNestMsgPB;
  721.  
  722.  
  723. struct IPMNewNestedMsgBlockPB {
  724.     IPMParamHeader
  725.     IPMMsgRef            msgRef;
  726.     OCERecipient*        recipient;
  727.     OCERecipient*        replyQueue;
  728.     StringPtr            procHint;
  729.     unsigned short        filler1;
  730.     IPMMsgType*            msgType;
  731.     unsigned long        refCon;
  732.     IPMMsgRef            newMsgRef;
  733.     unsigned short        filler2;
  734.     long                startingOffset;
  735.     AuthIdentity        identity;
  736.     IPMSender*            sender;
  737.     unsigned long        internalUse;
  738.     unsigned long        internalUse2;
  739. };
  740.  
  741. typedef struct IPMNewNestedMsgBlockPB IPMNewNestedMsgBlockPB;
  742.  
  743.  
  744. struct IPMEndMsgPB {
  745.     IPMParamHeader
  746.     IPMMsgRef            msgRef;
  747.     IPMMsgID            msgID;
  748.     RString*            msgTitle;
  749.     IPMNotificationType    deliveryNotification;
  750.     IPMPriority            priority;
  751.     Boolean                cancel;
  752.     Byte                padByte;
  753.     long                reserved;
  754.     SIGSignaturePtr        signature;
  755.     Size                signatureSize;
  756.     SIGContextPtr        signatureContext;
  757.     OSType                family;            /* family this msg belongs (e.g. mail) */
  758.                                         /* use kIPMFamilyUnspecified by default */
  759. };
  760.  
  761. typedef struct IPMEndMsgPB IPMEndMsgPB;
  762.  
  763.  
  764. typedef struct IPMAddRecipientPB {
  765.     IPMParamHeader
  766.     IPMMsgRef            msgRef;
  767.     OCERecipient*        recipient;
  768.     long                reserved;
  769. };
  770.  
  771. typedef struct IPMAddRecipientPB IPMAddRecipientPB;
  772.  
  773.  
  774. struct IPMAddReplyQueuePB {
  775.     IPMParamHeader
  776.     IPMMsgRef            msgRef;
  777.     long                filler;
  778.     OCERecipient*        replyQueue;
  779. };
  780.  
  781. typedef struct IPMAddReplyQueuePB IPMAddReplyQueuePB;
  782.  
  783.  
  784. struct IPMNewBlockPB {
  785.     IPMParamHeader
  786.     IPMMsgRef            msgRef;
  787.     IPMBlockType        blockType;
  788.     unsigned short        filler[5];
  789.     unsigned long        refCon;
  790.     unsigned short        filler2[3];
  791.     long                startingOffset;
  792. };
  793.  
  794. typedef struct IPMNewBlockPB IPMNewBlockPB;
  795.  
  796.  
  797. struct IPMWriteMsgPB {
  798.     IPMParamHeader
  799.     IPMMsgRef            msgRef;
  800.     IPMAccessMode        mode;
  801.     long                offset;
  802.     unsigned long        count;
  803.     Ptr                    buffer;
  804.     unsigned long        actualCount;
  805.     Boolean                currentBlock;
  806. };
  807.  
  808. typedef struct IPMWriteMsgPB IPMWriteMsgPB;
  809.  
  810.  
  811.  
  812.  
  813. union IPMParamBlock {
  814.     struct {IPMParamHeader}            header;
  815.     IPMOpenContextPB                openContextPB;
  816.     IPMCloseContextPB                closeContextPB;
  817.     IPMCreateQueuePB                createQueuePB;
  818.     IPMDeleteQueuePB                deleteQueuePB;
  819.     IPMOpenQueuePB                    openQueuePB;
  820.     IPMCloseQueuePB                    closeQueuePB;
  821.     IPMEnumerateQueuePB                enumerateQueuePB;
  822.     IPMChangeQueueFilterPB            changeQueueFilterPB;
  823.     IPMDeleteMsgRangePB                deleteMsgRangePB;
  824.     IPMOpenMsgPB                    openMsgPB;
  825.     IPMOpenHFSMsgPB                    openHFSMsgPB;
  826.     IPMOpenBlockAsMsgPB                openBlockAsMsgPB;
  827.     IPMCloseMsgPB                    closeMsgPB;
  828.     IPMGetMsgInfoPB                    getMsgInfoPB;
  829.     IPMReadHeaderPB                    readHeaderPB;
  830.     IPMReadRecipientPB                readRecipientPB;
  831.     IPMReadReplyQueuePB                readReplyQueuePB;
  832.     IPMGetBlkIndexPB                getBlkIndexPB;
  833.     IPMReadMsgPB                    readMsgPB;
  834.     IPMVerifySignaturePB            verifySignaturePB;
  835.     IPMNewMsgPB                        newMsgPB;
  836.     IPMNewHFSMsgPB                    newHFSMsgPB;
  837.     IPMNestMsgPB                    nestMsgPB;
  838.     IPMNewNestedMsgBlockPB            newNestedMsgBlockPB;
  839.     IPMEndMsgPB                        endMsgPB;
  840.     IPMAddRecipientPB                addRecipientPB;
  841.     IPMAddReplyQueuePB                addReplyQueuePB;
  842.     IPMNewBlockPB                    newBlockPB;
  843.     IPMWriteMsgPB                    writeMsgPB;
  844. };
  845.  
  846. typedef union IPMParamBlock IPMParamBlock;
  847. typedef IPMParamBlock *IPMParamBlockPtr;
  848.  
  849. /*    Request codes */
  850. #define kIPMOpenContext                0x400
  851. #define kIPMCloseContext            0x401
  852. #define kIPMNewMsg                    0x402
  853. #define kIPMAddRecipient            0x403
  854. #define kIPMNewBlock                0x404
  855. #define kIPMNewNestedMsgBlock        0x405
  856. #define kIPMNestMsg                    0x406
  857. #define kIPMWriteMsg                0x407
  858. #define kIPMEndMsg                    0x408
  859. #define kIPMOpenQueue                0x409
  860. #define kIPMCloseQueue                0x40A
  861. #define kIPMOpenMsg                    0x40B
  862. #define kIPMCloseMsg                0x40C
  863. #define kIPMReadMsg                    0x40D
  864. #define kIPMReadHeader                0x40E
  865. #define kIPMOpenBlockAsMsg            0x40F
  866. #define kIPMReadRecipient            0x410
  867. #define kIPMCreateQueue                0x411
  868. #define kIPMDeleteQueue                0x412
  869. #define kIPMEnumerateQueue            0x413
  870. #define kIPMChangeQueueFilter        0x414
  871. #define kIPMDeleteMsgRange            0x415
  872. #define kIPMOpenHFSMsg                0x417
  873. #define kIPMGetBlkIndex                0x418
  874. #define kIPMGetMsgInfo                0x419
  875.  
  876. #define kIPMAddReplyQueue            0x41D
  877. #define kIPMNewHFSMsg                0x41E
  878.  
  879. #define kIPMReadReplyQueue            0x421
  880. #define kIPMVerifySignature            0x422
  881.  
  882.  
  883.  
  884. #ifdef __cplusplus
  885. extern "C" {
  886. #endif
  887.  
  888. pascal OSErr IPMOpenContext(IPMParamBlockPtr paramBlock, Boolean async)
  889.     = {0x3F3C, kIPMOpenContext, _oceTBDispatch};
  890.  
  891. pascal OSErr IPMCloseContext(IPMParamBlockPtr paramBlock, Boolean async)
  892.     = {0x3F3C, kIPMCloseContext, _oceTBDispatch};
  893.  
  894. pascal OSErr IPMNewMsg(IPMParamBlockPtr paramBlock, Boolean async)
  895.     = {0x3F3C, kIPMNewMsg, _oceTBDispatch};
  896.  
  897. pascal OSErr IPMNewBlock(IPMParamBlockPtr paramBlock, Boolean async)
  898.     = {0x3F3C, kIPMNewBlock, _oceTBDispatch};
  899.  
  900. pascal OSErr IPMNewNestedMsgBlock(IPMParamBlockPtr paramBlock, Boolean async)
  901.     = {0x3F3C, kIPMNewNestedMsgBlock, _oceTBDispatch};
  902.  
  903. pascal OSErr IPMNestMsg(IPMParamBlockPtr paramBlock, Boolean async)
  904.     = {0x3F3C, kIPMNestMsg, _oceTBDispatch};
  905.  
  906. pascal OSErr IPMWriteMsg(IPMParamBlockPtr paramBlock, Boolean async)
  907.     = {0x3F3C, kIPMWriteMsg, _oceTBDispatch};
  908.  
  909. pascal OSErr IPMEndMsg(IPMParamBlockPtr paramBlock, Boolean async)
  910.     = {0x3F3C, kIPMEndMsg, _oceTBDispatch};
  911.  
  912. pascal OSErr IPMOpenQueue(IPMParamBlockPtr paramBlock, Boolean async)
  913.     = {0x3F3C, kIPMOpenQueue, _oceTBDispatch};
  914.  
  915. pascal OSErr IPMCloseQueue(IPMParamBlockPtr paramBlock, Boolean async)
  916.     = {0x3F3C, kIPMCloseQueue, _oceTBDispatch};
  917.  
  918. pascal OSErr IPMVerifySignature(IPMParamBlockPtr paramBlock)        /* Always synchronous */
  919.     = {0x7000, 0x1f00, 0x3F3C, kIPMVerifySignature, _oceTBDispatch};
  920.  
  921. pascal OSErr IPMOpenMsg(IPMParamBlockPtr paramBlock, Boolean async)
  922.     = {0x3F3C, kIPMOpenMsg, _oceTBDispatch};
  923.  
  924. pascal OSErr IPMCloseMsg(IPMParamBlockPtr paramBlock, Boolean async)
  925.     = {0x3F3C, kIPMCloseMsg, _oceTBDispatch};
  926.  
  927. pascal OSErr IPMReadMsg(IPMParamBlockPtr paramBlock, Boolean async)
  928.     = {0x3F3C, kIPMReadMsg, _oceTBDispatch};
  929.  
  930. pascal OSErr IPMReadHeader(IPMParamBlockPtr paramBlock, Boolean async)
  931.     = {0x3F3C, kIPMReadHeader, _oceTBDispatch};
  932.  
  933. pascal OSErr IPMOpenBlockAsMsg(IPMParamBlockPtr paramBlock, Boolean async)
  934.     = {0x3F3C, kIPMOpenBlockAsMsg, _oceTBDispatch};
  935.  
  936. pascal OSErr IPMNewHFSMsg(IPMParamBlockPtr paramBlock, Boolean async)
  937.     = {0x3F3C, kIPMNewHFSMsg, _oceTBDispatch};
  938.  
  939. pascal OSErr IPMReadRecipient(IPMParamBlockPtr paramBlock, Boolean async)
  940.     = {0x3F3C, kIPMReadRecipient, _oceTBDispatch};
  941.  
  942. pascal OSErr IPMReadReplyQueue(IPMParamBlockPtr paramBlock, Boolean async)
  943.     = {0x3F3C, kIPMReadReplyQueue, _oceTBDispatch};
  944.  
  945. pascal OSErr IPMCreateQueue(IPMParamBlockPtr paramBlock, Boolean async)
  946.     = {0x3F3C, kIPMCreateQueue, _oceTBDispatch};
  947.  
  948. pascal OSErr IPMDeleteQueue(IPMParamBlockPtr paramBlock, Boolean async)
  949.     = {0x3F3C, kIPMDeleteQueue, _oceTBDispatch};
  950.  
  951. pascal OSErr IPMEnumerateQueue(IPMParamBlockPtr paramBlock, Boolean async)
  952.     = {0x3F3C, kIPMEnumerateQueue, _oceTBDispatch};
  953.  
  954. pascal OSErr IPMChangeQueueFilter(IPMParamBlockPtr paramBlock, Boolean async)
  955.     = {0x3F3C, kIPMChangeQueueFilter, _oceTBDispatch};
  956.  
  957. pascal OSErr IPMDeleteMsgRange(IPMParamBlockPtr paramBlock, Boolean async)
  958.     = {0x3F3C, kIPMDeleteMsgRange, _oceTBDispatch};
  959.  
  960. pascal OSErr IPMAddRecipient(IPMParamBlockPtr paramBlock, Boolean async)
  961.     = {0x3F3C, kIPMAddRecipient, _oceTBDispatch};
  962.  
  963. pascal OSErr IPMAddReplyQueue(IPMParamBlockPtr paramBlock, Boolean async)
  964.     = {0x3F3C, kIPMAddReplyQueue, _oceTBDispatch};
  965.  
  966. pascal OSErr IPMOpenHFSMsg(IPMParamBlockPtr paramBlock, Boolean async)
  967.     = {0x3F3C, kIPMOpenHFSMsg, _oceTBDispatch};
  968.  
  969. pascal OSErr IPMGetBlkIndex(IPMParamBlockPtr paramBlock, Boolean async)
  970.     = {0x3F3C, kIPMGetBlkIndex, _oceTBDispatch};
  971.  
  972. pascal OSErr IPMGetMsgInfo(IPMParamBlockPtr paramBlock, Boolean async)
  973.     = {0x3F3C, kIPMGetMsgInfo, _oceTBDispatch};
  974.  
  975.  
  976. #ifdef __cplusplus
  977. };
  978. #endif
  979.  
  980.  
  981.  
  982.  
  983. /****************************************************************************************/
  984. /* EXTERNAL ROUTINES */
  985.  
  986. #ifndef __OCEMessaging
  987. #define __OCEMessaging(selector) = { 0x303C, selector, 0xAA5C}
  988. #endif
  989.  
  990. #define kOCESizePackedRecipient        830
  991. #define kOCEPackRecipient            831
  992. #define kOCEUnpackRecipient            832
  993. #define kOCEStreamRecipient            833
  994. #define kOCEGetRecipientType        834
  995. #define kOCESetRecipientType        835
  996.  
  997.  
  998. #ifdef __cplusplus
  999. extern "C" {
  1000. #endif
  1001.  
  1002. /*
  1003. Compute the space that a OCERecipient would take if it were in packed
  1004. form.  [Note: does NOT even pad extensionSize, so you may get an odd #back out]
  1005. Safe to pass dereferenced handle(s).
  1006. */
  1007.  
  1008. pascal unsigned short OCESizePackedRecipient(const OCERecipient *rcpt)
  1009.     __OCEMessaging(kOCESizePackedRecipient);
  1010.  
  1011.  
  1012. /*
  1013. Take an OCERecipient (scatter) and (gather) stream into the specified
  1014. buffer.  It is assumed that there is sufficient space in the buffer (that is
  1015. OCESizePackedRecipient).  Safe to pass dereferenced handle(s).
  1016. */
  1017. pascal unsigned short OCEPackRecipient(const OCERecipient *rcpt, void* buffer)
  1018.     __OCEMessaging(kOCEPackRecipient);
  1019.  
  1020. /*
  1021. Take a packed OCERecipient and cast a the OCERecipient frame over it. Returns
  1022. amBadDestId if it doesn't look like an OCERecipient. Safe to pass dereferenced
  1023. handle(s).
  1024. */
  1025. pascal OSErr OCEUnpackRecipient(const void* buffer, OCERecipient *rcpt,
  1026.         RecordID *entitySpecifier)
  1027.     __OCEMessaging(kOCEUnpackRecipient);
  1028.  
  1029.  
  1030. /*
  1031. Take an OCERecipient (scatter) and (gather) stream using the specified
  1032. function.  Safe to pass dereferenced handle(s).  If streamer function returns
  1033. OCEError OCEStreamRecipient stops execution and passes the error back to the caller
  1034. */
  1035. typedef pascal OSErr (*OCERecipientStreamer)(
  1036.     void* buffer, unsigned long count, Boolean eof, long userData);
  1037.  
  1038. pascal OSErr OCEStreamRecipient(const OCERecipient* rcpt, OCERecipientStreamer stream,
  1039.         long userData, unsigned long* actualCount)
  1040.     __OCEMessaging(kOCEStreamRecipient);
  1041.  
  1042.  
  1043. /* Get the OCERecipient's extensionType. Safe to pass dereferenced handle(s).*/
  1044.  
  1045. pascal OSType OCEGetRecipientType(const CreationID *cid)
  1046.     __OCEMessaging(kOCEGetRecipientType);
  1047.  
  1048.  
  1049. /*
  1050. Set the OCERecipient's extensionType in the specified cid.  (Note: we do NOT
  1051. check for a nil pointer).  If the extensionType is 'entn', the cid is assumed
  1052. to be "valid" and is not touched.  Note: to properly handle non 'entn''s this
  1053. routine must and will zero the high long (source) of the cid! Safe to pass
  1054. dereferenced handle(s).
  1055. */
  1056. pascal void OCESetRecipientType(OSType extensionType, CreationID *cid)
  1057.     __OCEMessaging(kOCESetRecipientType);
  1058.  
  1059.  
  1060. #ifdef __cplusplus
  1061. };
  1062. #endif
  1063.  
  1064.  
  1065. #endif
  1066.